package com.huike.web.controller.clues;

import com.huike.clues.domain.TbRulePool;
import com.huike.clues.service.TbRulePoolService;
import com.huike.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 线索池控制层
 *
 * @author makangkang
 * @date 2025/10/27 15:09
 */
@RestController
@RequestMapping("/rule/pool")
public class TbRulePoolController {

    @Autowired
    private TbRulePoolService tbRulePoolService;


    /**
     * 修改线索或商机池规则
     *
     * @param tbRulePool
     * @return
     */
    @PutMapping
    public AjaxResult updateTbRulePool(TbRulePool tbRulePool) {
        return AjaxResult.success(tbRulePoolService.updateTbRulePool(tbRulePool));
    }

    /**
     * 获取规则基础信息type=0 线索 type=1 商机
     *
     * @param type
     * @return
     */
    @GetMapping("/{type}")
    public AjaxResult selectTbRulePool(@PathVariable Integer type) {
        List<TbRulePool> tbRulePoolList = tbRulePoolService.selectTbRulePool(type);
        return AjaxResult.success(tbRulePoolList);
    }

}
